<script setup lang="ts">
import {CERTIFICATE_TYPE, EXAMINE_STATUS, PAY_TYPE} from "~/const/Maps";
definePageMeta({
  title:'认证列表',
  layout:'admin',
})
const form=reactive({
  limit:20,
  page:1,
  certification_type:10,
  examine_status:0,
});

const {data:list,refresh}=await useServerGet('/user/getCertificationList',form)
const search=()=>{
  refresh&&refresh();
}
</script>

<template>
  <div>
    <el-card>
      <div class="flex">
        <div class="w-52">
          <el-select v-model="form.certification_type" placeholder="认证类型">
            <el-option :value="value*1" :label="label" v-for="(label,value) in CERTIFICATE_TYPE"></el-option>
          </el-select>
        </div>
        <div class="w-52 mx-2">
          <el-select v-model="form.examine_status" placeholder="审核状态">
            <el-option :value="value*1" :label="label" v-for="(label,value) in EXAMINE_STATUS"></el-option>
          </el-select>
        </div>
        <div class="w-20">
          <el-button type="primary" @click="search">搜索</el-button>
        </div>
      </div>
    </el-card>
    <el-card class="mt-4">
      <el-table
          ref="multipleTable1"
          :data="list.data.list"
          tooltip-effect="dark"
          style="width: 100%"
          align="center"
      >
        <el-table-column label="认证ID">
          <template #default="scope">{{ scope.row.id }}</template>
        </el-table-column>
        <el-table-column label="认证类型">
          <template #default="scope">{{ CERTIFICATE_TYPE[scope.row.certification_type] }}</template>
        </el-table-column>
        <el-table-column label="证件信息" width="400">
          <template #default="scope">
            <p>姓名{{ scope.row.surname }}{{scope.row.name}}</p>
            <p>身份证号：{{scope.row.id_card_number}}</p>
            <div v-if="scope.row.certification_type==20">
              <p>企业名称{{ scope.row.business_name }}</p>
              <p>营业执照号：{{scope.row.business_license_number}}</p>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="证件照">
          <template #default="scope">
            <MyImage :src="scope.row.id_card_front" :list="scope.row.certification_type==20?[scope.row.id_card_front,scope.row.id_card_opposite,scope.row.id_card_opposite]:[scope.row.id_card_front,scope.row.id_card_opposite]" />          </template>
        </el-table-column>
          <el-table-column label="审核状态">
            <template #default="scope">{{ EXAMINE_STATUS[scope.row.examine_status] }}</template>
          </el-table-column>
          <el-table-column
              label="是否同步">
            <template #default="scope">{{ scope.row.sync_tpl==1?'是':'否' }}</template>
          </el-table-column>
        <el-table-column
            prop="created_at"
            label="创建时间"
        >
        </el-table-column>
        <el-table-column
            prop="updated_at"
            label="更新时间"
        >
        </el-table-column>
      </el-table>
      <MyPage v-model:page="form.page" v-model:perpage="form.limit" v-model:total="list.data.total" @change="refresh"></MyPage>
    </el-card>
  </div>
</template>

<style scoped lang="scss">

</style>